package com.fawde.mall.vo;

import com.alibaba.fastjson.JSON;

/**
 * 描述：统一返回实体类
 *
 * @author xiaohei on 2022/8/24
 * @since 1.0.0
 */
public class RespBean {
    private  long code ;
    private  String msg;
    private  Object data;

    public RespBean(long code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public RespBean() {
    }

    public static String retData(RespBeanEnum respBeanEnum, Object o){
        RespBean respBean = new RespBean(respBeanEnum.getCode(),respBeanEnum.getMsg(),o);
        return JSON.toJSONString(respBean);
    }
    public static String retMsg(RespBeanEnum respBeanEnum){
        return JSON.toJSONString(new RespBean(respBeanEnum.getCode(),respBeanEnum.getMsg(),null));
    }

    public long getCode() {
        return code;
    }

    public void setCode(long code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
